<?php

class Application_Form_Registration extends Zend_Form {

	public function init() {
		$this->setMethod('post');
		$this->setAction('/user/registration');

		// Поле login
		$this->addElement('text', 'login', array(
			'label'      => 'Ваш login',
			'required'   => true,
			'filters'    => array('StringTrim')
		));

		// Поле password
		$this->addElement('password', 'password', array(
			'label'      => 'Ваш password:',
			'required'   => true,
			'filters'    => array('StringTrim')
		));

		// Поле ФИО
		$this->addElement('text', 'fio', array(
			'label'      => 'Ваши ФИО:',
			'required'   => true,
			'filters'    => array('StringTrim')
		));

		// Каптча
		$this->addElement('captcha', 'captcha', array(
			'label'      => 'Введите символы с картинки:',
			'required'   => true,
			'captcha'    => array(
				'captcha' => 'Image',
				'font' => APPLICATION_PATH . '/../public/fonts/arial.ttf',
				'fontSize' => '30',
				'height' => '50',
				'width' => '144',
				'imgDir' => APPLICATION_PATH . '/../public/img/captcha',
				'imgUrl' => '/img/captcha',
				'wordLen' => 5,
				'timeout' => 300
			)
		));

		// Кнопка войти
		$this->addElement('submit', 'submit', array(
			'ignore'   => true,
			'label'    => 'Войти',
		));

		// Защита CSRF
		$this->addElement('hash', 'csrf', array(
			'ignore' => true,
		));
	}
}